<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>盒子模型-外边距特性</title>
    <style>
        .box1,.box2,.box3,.box4{
            width: 200px;
            height: 200px;
        }
        .box1{
            background: red;
            margin-bottom: 100px;
        }
        .box2{
            background: yellow;
            margin-top: 100px;
        }
        .box3{
            background: blue;
            float: left;
            margin-right: 100px;
        }
        .box4{
            background: green;
            float: left;
            margin-left: 100px;
        }
    </style>
</head>
<body>
    <!-- 当上下结构的时候  取外边距的最大值 -->
    <div class="box1"></div>
    <div class="box2"></div>
    <!-- 当左右结构的时候，取边距之和 -->
    <div class="box3"></div>
    <div class="box4"></div>
</body>
</html>